package com.ggh.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ggh.entity.TypeBean;
import com.ggh.entity.User;
import com.ggh.entity.UserRecord;
import com.ggh.entity.WithDraw;
import com.ggh.service.WithDrawService;
import com.ggh.util.JsonUtils;
import com.ggh.vo.UserToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;

/**
 * 提现
 * @author jj
 * @date 2019/10/14 15:31
 */
@Controller
@RequestMapping("withdraw")
public class WithDrawController {
    @Autowired
    private WithDrawService withDrawService;
    /**
    * @description :查询全部战绩
    * @return: java.util.List<com.ggh.entity.UserRecord>
    * @date : 2019/10/14 15:44
    * @author : jj
    * @throws
    */
    @RequestMapping(value = "/tx",method = RequestMethod.POST)
    @ResponseBody
    public UserToken tx(WithDraw withDraw){
        boolean b = withDrawService.wdDeposit(withDraw);
        if (withDraw.getType()==1) {
            if (b) {
                return UserToken.newInstance(withDraw.getUserid(), "HallTiXianZFB", "提现成功,等待客服审核！", TypeBean.SUCCESS);
            } else {
                return UserToken.newInstance(withDraw.getUserid(), "HallTiXianZFB", "提现异常！", TypeBean.SUCCESS);
            }
        }
        if (b) {
            return UserToken.newInstance(withDraw.getUserid(), "HallTiXianBank", "提现成功,等待客服审核！", TypeBean.SUCCESS);
        } else {
            return UserToken.newInstance(withDraw.getUserid(), "HallTiXianBank", "提现异常！", TypeBean.SUCCESS);
        }
    }


}
